package com.bkck.sharkblockade.highscores;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class ScoresDictionaryOpenHelper extends SQLiteOpenHelper{

	private static final String DATABASE_NAME = "scoresDB";
	private static final int DATABASE_VERSION = 2;
	private static final String scoresTable = "Scores";
	private static final String colID = "ScoreID";
	private static final String colName = "Name";
	private static final String colPoints = "Points";
	private static final String colDate = "Date";
	private static final String colLevel = "Level";
	
	public ScoresDictionaryOpenHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE " + scoresTable + " (" + colID + " INTEGER PRIMARY KEY"
				+ " AUTOINCREMENT, " + colName + " TEXT, " + colDate + " INTEGER, " 
				 + colLevel + " INTEGER, " + colPoints + " INTEGER " + "NOT NULL);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP TABLE IF EXISTS " + scoresTable);
		onCreate(db);
	}

}
